import { Component, createApp } from 'vue'
import App from './App.vue'
import router, { setupRouter } from './router'
import { setupStore } from './store'
import 'normalize.css'
import '@/assets/styles/index.scss'
import './permission'
import { loadAllPlugins } from './plugins'
import { setupGlobalComponents } from './components'

async function bootstrap() {
  const app = createApp(App)
  // 设置路由
  setupRouter(app)

  // 注册vuex状态管理
  setupStore(app)

// 加载所有的插件
  loadAllPlugins(app)

  // 注册全局组件
  setupGlobalComponents(app)
  
  // 等待路由加载完成
  await router.isReady()

  app.mount('#app')
}

bootstrap()
